﻿@model Fcom.VNInsurance.Web.Models.BaseBenefitLang
@{
    ViewBag.Title = "AddBenefit";
    Layout = "~/Views/Shared/_CpanelLayout.cshtml";
    var cat = (IEnumerable<Fcom.VNInsurance.Web.Models.Coverage>)ViewBag.Coverage;
}
<script src="@Url.Content("~/Content/tinymce/tinymce.min.js")"></script>
<script>
        tinymce.init({selector:'textarea'});
</script>
<script type="text/javascript">
    $(document).ready(function () {
        ChangeGroup($("#benefitcat").val());

        $("#benefitcat").change(function () {
            ChangeGroup(this.value)
        });
    })
    function ChangeGroup(value) {
        var parent = $("#parentid").text();
        var valu = value;
        $.ajax({
            type: "post",
            url: "@Url.Action("GetBeneParent","Benefit")",
            data: { id: valu },
            datatype: "json",
            success: function (rvdata) {
                $("#parent").html("");
                $("#parent").html("<option value='null'>--SELECT--</option>")
                $(rvdata).each(function (index, com) {
                    if (com.DisplayName != $("#benefitname").text()) {
                        $("#parent").append("<option value='" + com.BenefitID + "'>" + com.DisplayName + "</option>");
                    }

                });
            }

        });



    }
</script>
<style>
    #parent
    {
        width:150px;
    }
</style>
<div class="container" style="padding:10px;">
    @using (Html.BeginForm())
    { 
        <fieldset>
                 <legend style="color:#a60002;">thêm thông tin chính sách  <span style="color:#000"></span></legend>
            </fieldset>
           <div class="form-group">

            <label for="txttitle">Tên quyền lợi  (*)</label>
          @Html.TextBoxFor(m=>m.BenefitName)
          </div>
          <div class="form-group">
                <label for="txttitle"> Nhóm quyền lợi (*)</label>
                @Html.DropDownListFor(m => m.CoverageID, new SelectList(cat, "ID", "Name"), new {id="benefitcat"})
            </div>
                 <div class="form-group">
                <label for="txttitle"> Tên quyền lợi cha</label>
                <select id="parent">
                  
                </select>
            </div>
          <div class="form-group">
                <label for="txttitle"> Input Key</label>
                @Html.TextBoxFor(m=>m.InputKey)
            </div>
         <div class="form-group">
                <label for="txttitle"> Chi tiết quyền lợi(*)</label>
                 @Html.TextAreaFor(m => m.Detail, new { id="detail",rows="15"})
            </div>
         <div class="form-group">
                <label for="txttitle"> Enadble 1(*)</label>
                 @Html.CheckBoxFor(m => m.EnableSubMoney)
            </div>
          <div class="form-group">
                <label for="txttitle"> Enadble 2(*)</label>
                 @Html.CheckBoxFor(m => m.EnableInsMoney)
            </div>
          <button type="submit" class="btn btn-success">Thêm thông tin quyền lợi </button>
    }

</div>

